var ClubUserItem = Item.extend({
    _ccsFileName: res.ClubUserItem_json,
    _data: null,
    _isUesrDetailsTpye: false,
    _group: null,
    _clubId: null,
    _isWinners: false,
    initItem: function () {

    },

    onEnter: function () {
        Item.prototype.onEnter.call(this);
        this._addClickListeners();
    },

    _initClickListeners: function () {
        this._clickListeners = {
            'userOverviewItem.btn_recrod': '_clickRecrodHandler',
        }
    },

    refreshData: function (data, cludId, group, isUesrDetailsTpye, isWinners) {
        if (isWinners != undefined && isWinners != null) this._isWinners = isWinners;
        else this._isWinners = false;
        this._data = data;
        this._clubId = cludId;
        this._isUesrDetailsTpye = isUesrDetailsTpye;
        this._group = group;
        this._nodeList['userDetailsItem'].setVisible(isUesrDetailsTpye);
        this._nodeList['userOverviewItem'].setVisible(!isUesrDetailsTpye);

        if (isUesrDetailsTpye) {
            this._refreshUesrDetails();
        } else {
            this._refreshUesrOverview();
        }
    },

    _refreshUesrDetails: function () {
        this._nodeList['userDetailsItem.lb_name'].setString(ellipsisStr(this._data['playerName'], ClubDataManager.NirckNameSize));
        this._nodeList['userDetailsItem.lb_uid'].setString(this._data['playerId']);
        this._nodeList['userDetailsItem.count1'].setString(this._data['roomCount2']);
        this._nodeList['userDetailsItem.count2'].setString(this._data['roomCount3']);
        this._nodeList['userDetailsItem.count3'].setString(this._data['roomCount4']);

        var allCoe = 1 / 2 * this._data['roomCount2'] + 1 / 3 * this._data['roomCount3'] + 1 / 4 * this._data['roomCount4'];
        this._nodeList['userDetailsItem.count4'].setString(allCoe.toFixed(2));
    },

    _refreshUesrOverview: function () {
        this._nodeList['userOverviewItem.lb_name'].setString(ellipsisStr(this._data['playerName'], ClubDataManager.NirckNameSize));
        //this._nodeList['userOverviewItem.lb_uid'].setString(this._data['playerId']);
        if (this._isWinners == true) {
            this._nodeList['userOverviewItem.txt_tips_01'].setVisible(false);
            this._nodeList['userOverviewItem.txt_tips_02'].setVisible(false);
            this._nodeList['userOverviewItem.txt_tips_02_0'].setVisible(true);
            this._nodeList['userOverviewItem.txt_tips_02_0'].setString(this._data['winnerCount'] + '/' +
                (this._data['winnerScore'] ? this._data['winnerScore'] : '0'));
        }
        else {
            this._nodeList['userOverviewItem.txt_tips_01'].setVisible(true);
            this._nodeList['userOverviewItem.txt_tips_02'].setVisible(true);
            this._nodeList['userOverviewItem.txt_tips_02_0'].setVisible(false);
            this._nodeList['userOverviewItem.txt_tips_01'].setString(this._data['totalCount'] + '/' +
                (this._data['totalScore'] ? this._data['totalScore'] : '0'));
            this._nodeList['userOverviewItem.txt_tips_02'].setString(this._data['winnerCount'] + '/' +
                (this._data['winnerScore'] ? this._data['winnerScore'] : '0'));
        }
        this._nodeList['userOverviewItem.group'].setString(this._data['group'] || '未分组');
        //this._nodeList['userOverviewItem.winnerCount'].setString(this._data['winnerCount']);
        //this._nodeList['userOverviewItem.totalScore'].setString(this._data['totalScore']);
        //this._nodeList['userOverviewItem.roomCount'].setString(this._data['roomCount']);
        //this._nodeList['userOverviewItem.fullRoomCount'].setString(this._data['fullRoomCount']);
    },

    _clickRecrodHandler: function () {
        if (!this._isUesrDetailsTpye) {
            showWindow('ClubZhiDingUesrRecordWindow', this._clubId, this._data['playerId']);
        }
    },


});